package com.mirabelle.juice.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the vendor database table.
 * 
 */
@Entity
@Table(name="vendor")
public class Vendor implements Serializable {
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String comment;
	private String name;
	private String url;
	private List<Additive> additives;
	private List<Aroma> aromas;
	private List<Base> bases;

	public Vendor() {
	}


	@Id
	@SequenceGenerator(name="VENDOR_ID_GENERATOR", sequenceName="SEQ_VENDOR_ID")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="VENDOR_ID_GENERATOR")
	@Column(unique=true, nullable=false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


	@Column(length=2147483647)
	public String getComment() {
		return this.comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}


	@Column(nullable=false, length=255)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}


	@Column(length=255)
	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}


	//bi-directional many-to-one association to Additive
	@OneToMany(mappedBy="vendor")
	public List<Additive> getAdditives() {
		return this.additives;
	}

	public void setAdditives(List<Additive> additives) {
		this.additives = additives;
	}

	public Additive addAdditive(Additive additive) {
		getAdditives().add(additive);
		additive.setVendor(this);

		return additive;
	}

	public Additive removeAdditive(Additive additive) {
		getAdditives().remove(additive);
		additive.setVendor(null);

		return additive;
	}


	//bi-directional many-to-one association to Aroma
	@OneToMany(mappedBy="vendor")
	public List<Aroma> getAromas() {
		return this.aromas;
	}

	public void setAromas(List<Aroma> aromas) {
		this.aromas = aromas;
	}

	public Aroma addAroma(Aroma aroma) {
		getAromas().add(aroma);
		aroma.setVendor(this);

		return aroma;
	}

	public Aroma removeAroma(Aroma aroma) {
		getAromas().remove(aroma);
		aroma.setVendor(null);

		return aroma;
	}


	//bi-directional many-to-one association to Base
	@OneToMany(mappedBy="vendor")
	public List<Base> getBases() {
		return this.bases;
	}

	public void setBases(List<Base> bases) {
		this.bases = bases;
	}

	public Base addBas(Base bas) {
		getBases().add(bas);
		bas.setVendor(this);

		return bas;
	}

	public Base removeBas(Base bas) {
		getBases().remove(bas);
		bas.setVendor(null);

		return bas;
	}

}